package com.we823.project.controller.product;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.we823.project.core.web.WebConstants;
import com.we823.utils.web.RequestUtil;

@Controller
@RequestMapping(WebConstants.PRODUCT_CARD)
public class CardController {
	private String baseUrl = WebConstants.PRODUCT_CARD_TEMPLATE;
	
	@RequestMapping("view")
	public String view(HttpServletRequest request,Model model) {
		String filename = RequestUtil.getValueByParam(request, "f");
		if (StringUtils.isEmpty(filename)) {
			model.addAttribute("message","没有工艺卡信息");
			model.addAttribute("hasError",true);
		}else {
			model.addAttribute("pdffile",filename);
			model.addAttribute("hasError",false);
		}
		return baseUrl +"card-view";
	}
}
